<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Powerless < wzxaini9@gmail.com>
// +----------------------------------------------------------------------
namespace app\user\model;

use think\Db;
use think\Model;

class UserAddressModel extends Model
{
    function get_address_list($uid,$is_default=0){
        if($is_default==0){
            $where['uid']=$uid;
            $address_list=$this->where($where)->select()->toArray();
        }else{
            $where['uid']=$uid;
            $where['is_default']=1;
            $address_list=$this->where($where)->select()->toArray();
            if($address_list==null){
                $address_list=$this->where('uid',$uid)->select()->toArray();
            }
        }
        return $address_list;
    }
}
